<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
  import ChatController from './socket/chatController'
  import { defaultChatList } from './api/chat'

  export default {
    mounted() {
      // 初始化WebSocket连接操作
      ChatController.init()
      // 初始化聊天用户
      this.initChatList()
    },
    methods: {
      initChatList() {
        // 初始化当前用户的消息内容
        const users = []
        for (let i = 0; i < defaultChatList.length; i++) {
          users[i] = defaultChatList[i].id
        }
        this.$store.dispatch('InitMessageInfo', users).then(res => {})
      }
    }
  }
</script>

<style lang="sass">
  @import './styles/index.scss'
  // 全局自定义的css样式
</style>
